<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Watson\Validating\ValidatingTrait;

class GgrSchoolEms extends Model
{
    use SoftDeletes;
    use ValidatingTrait;

    protected $table = 'ggr_school_ems';

    protected $fillable = ['status', 'ems_content' , 'ems_number' , 'ems_company' , 'ggr_school_id'];

    protected $rules = [
        'ggr_school_id'      => 'required',
        'teacher_id'         => 'required',
        'ems_content'        => 'required',
    ];

    protected $validationMessages = [
        'ggr_school_id.required'           => '学校必填',
        'teacher_id.required'              => '收件老师必填',
        'ems_content.required'             => '邮寄内容必填',
    ];

    public function teacher()
    {
        return $this->belongsTo('\App\Models\Teacher' , 'teacher_id');
    }

    public function ggrSchool()
    {
        return $this->belongsTo('\App\Models\GgrSchool' , 'ggr_school_id');
    }
}
